/*
 * Copyright Thoughtworks, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
@use "sass:color";

/* CSS 3 Mixins*/

@mixin box-shadow($top, $left, $blur, $color, $inset: false) {
  @if $inset {
    box-shadow: inset $top $left $blur $color;
  } @else {
    box-shadow: $top $left $blur $color;
  }
}

@mixin -go-opacity($trans) {
  opacity: $trans;
  filter: alpha(opacity=$trans * 100);
}

@mixin button($color: $red, $text_color: $white) {
  display: inline-block;
  outline: none;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font: 14px/100% Arial, Helvetica, sans-serif;
  padding: .5em 2em .55em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
  @include rounded();
  @include box-shadow(0, 1px, 2px, rgba(0, 0, 0, 0.2));
  color: $text_color !important;
  font-weight: bold;
  border: solid 1px color.adjust($color, $lightness: -18%);
  background: $color;
  @include gradient(color.adjust($color, $saturation: 15%), color.adjust($color, $lightness: -15%));
  &:hover {
    text-decoration: none;
    background: color.adjust($color, $saturation: 10%);
    @include gradient(color.adjust($color, $saturation: 5%), color.adjust($color, $lightness: -5%));
  }
  &:active {
    position: relative;
    top: 1px;
    color: color.adjust($color, $saturation: 15%);
    @include gradient(color.adjust($color, $saturation: 15%), color.adjust($color, $lightness: 15%));
  }
}

@mixin rounded($radius: 0.5em) {
  border-radius: $radius;
}

@mixin gradient($from, $to) {
  background: -webkit-gradient(linear, left top, left bottom, from($from), to($to));
  background: -moz-linear-gradient(top, $from, $to);
}